import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;

public class Main {
    public static void main(String[] args) {
        File f = new File("java");
        boolean exist = f.exists();
        if (!exist)
            try {
                f.createNewFile();
            }catch (IOException e){
                e.printStackTrace();
            }
        else{
            f.delete();
        }

        System.out.println(exist);
        boolean r = f.canRead();
        boolean w = f.canWrite();
        System.out.println("可读性：" + r);
        System.out.println("可写性：" + w);

        File f2 = new File("src","Main.java");
        boolean exist2 = f2.exists();
        System.out.println(exist2);
        System.out.println(f2.getAbsolutePath());
        boolean r2 = f2.canRead();
        boolean w2 = f2.canWrite();
        System.out.println("可读性2：" +r2);
        System.out.println("可写性2：" +w2);
        boolean e2 = f.canExecute();
        System.out.println("可执行性2：" + e2);
        File f = new File("test");
        System.out.println(f.getAbsolutePath());
        boolean rs = f.mkdir();
        if (rs){
            System.out.println("目录创建成功");
        }
        File seachedDir = new File("test");
        System.out.println(seachedDir.getAbsolutePath());
        String[] listFiles = seachedDir.list();
        if (listFiles !=null){
            for (String fileName : listFiles){
                System.out.println(fileName);
            }
        }
        System.out.println("_________________________");
        FileAccept fileAccept = new FileAccept();
        String[] fileredNames = seachedDir.list(fileAccept);
        if (fileredNames != null){

        }
    }
}